/*
 * ui.h
 *
 *  Created on: Oct 12, 2011
 *      Author: welcome
 */

#ifndef UI_H_
#define UI_H_

#include <rdesktop.h>

#ifdef __cplusplus
extern "C" {
#endif

extern uint16 ui_get_numlock_state(unsigned int state);
extern unsigned int read_keyboard_state();

extern void ui_clip_format_announce(uint8 * data, uint32 length);
extern void ui_clip_handle_data(uint8 * data, uint32 length);
extern void ui_clip_request_failed(void);
extern void ui_clip_request_data(uint32 format);
extern void ui_clip_sync(void);
extern void ui_clip_set_mode(const char *optarg);
extern void xclip_init(void);
extern void xclip_deinit(void);

extern RD_BOOL ui_init(KDint width, KDint height);
extern void ui_deinit(void);
extern RD_BOOL ui_create_window(void);
extern void ui_resize_window(void);
extern void ui_destroy_window(void);
extern void xwin_toggle_fullscreen(void);
extern int ui_select(int rdp_socket);

extern void ui_move_pointer(int x, int y);

extern RD_HBITMAP ui_create_bitmap(int width, int height, uint8 * data);

extern void ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height,
		uint8 * data);
extern void ui_destroy_bitmap(RD_HBITMAP bmp);
extern RD_HGLYPH ui_create_glyph(int width, int height, uint8 * data);
extern void ui_destroy_glyph(RD_HGLYPH glyph);
extern RD_HCURSOR ui_create_cursor(unsigned int x, unsigned int y, int width,
		int height, uint8 * andmask, uint8 * xormask, int bpp);
extern void ui_set_cursor(RD_HCURSOR cursor);
extern void ui_destroy_cursor(RD_HCURSOR cursor);
extern void ui_set_null_cursor(void);
extern RD_HCOLOURMAP ui_create_colourmap(COLOURMAP * colours);
extern void ui_destroy_colourmap(RD_HCOLOURMAP map);
extern void ui_set_colourmap(RD_HCOLOURMAP map);
extern void ui_set_clip(int x, int y, int cx, int cy);
extern void ui_reset_clip(void);
extern void ui_bell(void);
extern void ui_destblt(uint8 opcode, int x, int y, int cx, int cy);
extern void ui_patblt(uint8 opcode, int x, int y, int cx, int cy, BRUSH * brush,
		int bgcolour, int fgcolour);
extern void ui_screenblt(uint8 opcode, int x, int y, int cx, int cy, int srcx,
		int srcy);
extern void ui_memblt(uint8 opcode, int x, int y, int cx, int cy, RD_HBITMAP src,
		int srcx, int srcy);
extern void ui_triblt(uint8 opcode, int x, int y, int cx, int cy, RD_HBITMAP src,
		int srcx, int srcy, BRUSH * brush, int bgcolour, int fgcolour);
extern void ui_line(uint8 opcode, int startx, int starty, int endx, int endy,
		PEN * pen);
extern void ui_rect(int x, int y, int cx, int cy, int colour);
extern void ui_polygon(uint8 opcode, uint8 fillmode, RD_POINT * point, int npoints,
		BRUSH * brush, int bgcolour, int fgcolour);
extern void ui_polyline(uint8 opcode, RD_POINT * points, int npoints, PEN * pen);
extern void ui_ellipse(uint8 opcode, uint8 fillmode, int x, int y, int cx, int cy,
		BRUSH * brush, int bgcolour, int fgcolour);
extern void ui_draw_glyph(int mixmode, int x, int y, int cx, int cy, RD_HGLYPH glyph,
		int srcx, int srcy, int bgcolour, int fgcolour);
extern void ui_draw_text(uint8 font, uint8 flags, uint8 opcode, int mixmode, int x,
		int y, int clipx, int clipy, int clipcx, int clipcy, int boxx,
		int boxy, int boxcx, int boxcy, BRUSH * brush, int bgcolour,
		int fgcolour, uint8 * text, uint8 length);
extern void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy);
extern void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy);
extern void ui_begin_update(void);
extern void ui_end_update(void);

#ifdef __cplusplus
}
#endif
#endif /* UI_H_ */
